package com.kai.service.exception;


import com.kai.service.enums.ResultCodeEnum;
import lombok.Getter;

/**
 * 通用异常
 */
public class GenericException extends RuntimeException {

    private static final long serialVersionUID = -4795618732627497160L;

    @Getter
    private final int errorCode;

    public GenericException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.errorCode = resultCodeEnum.getCode();
    }


    public GenericException(String msg){
        super(msg);
        this.errorCode = ResultCodeEnum.BASE_ERROR.getCode();
    }

}
